package java1024;
class NoLowerLetter extends Exception{
    public void print() {
        System.out.printf("%c",'#');
    }
}
class NoDigit extends Exception{
    public void print() {
        System.out.printf("%c", '*');
    }
}
class People{
    void printLetter(char c) throws NoLowerLetter {
        if (c < 'a' || c > 'z') {
            NoLowerLetter noLowerLetter=new NoLowerLetter();
            throw noLowerLetter;
        }
    }
    void printDigit(char c) throws NoDigit{
        if(c<'1'||c>'9'){
            NoDigit noDigit=new NoDigit();
            throw noDigit;
        }
    }
}
 class BinarySearchTree {

    static class TreeNode {
        public int val;
        public TreeNode left;
        public TreeNode right;

        public TreeNode(int val) {
            this.val = val;
        }
    }

    public TreeNode root;

    public TreeNode search(int key) {
        TreeNode cur=root;
        while (cur!=null){
            if(cur.val>key){
                cur=cur.left;
            }
            else if(cur.val<key){
                cur=cur.right;
            }
            else {
                return cur;
            }
        }
        return null;
    }
     public boolean insertTree(int val) {
         if(root == null) {
             root = new TreeNode(val);
             return true;
         }
         TreeNode cur=root;
         TreeNode prev=null;
         TreeNode node=new TreeNode(val);
         while (cur!=null){
             if(cur.val>val){
                 prev=cur;
             }
             else {
                 prev=cur;
             }
             cur=cur.right;
         }
         if (prev.val>val){
             prev.left=node;
         }
         else {
             prev.right=node;
         }
         return true;
     }
}
public class TestDemo1 {
    public static void proc() throws IllegalAccessException{
        System.out.println("s");
        throw new  IllegalAccessException("fsdfs");
    }
    public static void main(String[] args) {
        try {
            proc();
        }
        catch (IllegalAccessException e){
            System.out.println("捕获"+e);
        }
    }
}
